﻿using System;
using System.Diagnostics;

namespace BEGDC.Utility.Log
{
    public class LogHelper
    {
        private static System.Diagnostics.EventLog log = null;

        public static void WriteLog(string message, System.Diagnostics.EventLogEntryType type)
        {
            try
            {

                if (log == null)
                {
                    if (!EventLog.SourceExists("e-Collection Service"))
                    {
                        EventLog.CreateEventSource("e-Collection Service", "Mail Log");
                    }
                    log = new EventLog();
                    log.Source = "e-Collection Service";
                }
                log.WriteEntry(message, type);
            }
            catch
            {
            }
        }
    }
}
